import {
	get,
	post
} from 'utils/requests'

/* 获取用户地址 */
export const getAgreementUrl = type => {
	return new Promise(async (resolve,reject) => {
		let {code:code,data:path} = await get({url: `/applet/index/advertisement/getAgreementByType/${type}`})
		if(code !== 200) return reject()
		uni.downloadFile({
			url: path,
			success({tempFilePath}) {resolve(tempFilePath)},
			error(){
				reject()
			}
		})
	})
}
